import Vue from 'vue';
import App from './App.vue';
// import VueRouter from 'vue-router';
// import routes from './route';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
// import Vuex from 'vuex';
import store from './store/index';
import router from './route/index';


Vue.config.productionTip = false;
// Vue.use(VueRouter);
Vue.use(ElementUI);
// Vue.use(Vuex);


/* const store = new Vuex.Store({
  state: {
    count: 0,
    menu: [],
    todos: [
      { id: 1, text: '...', done: true },
      { id: 2, text: '...', done: false },
      { id: 3, text: '44444', done: true }
    ],
    imgPrefix: 'http://sd.martin.net/storage/',
  },
  mutations: {
    increment (state) {
      state.count++;
    }
  },
  getters: {
    doneTodos: state => {
      return state.todos.filter(todo => todo.done);
    },
    doneTodosCount: (state, getters) => {
      return getters.doneTodos.length;
    },
    imgPrefix: state => state.imgPrefix,
  }
}); */

/* const router = new VueRouter({
  routes,
  // mode: 'history',
}); */


/* router.beforeEach((to, from , next) => {
  let path = to.path;
  if (path === '/login') {
    next();
  }
  if (localStorage.getItem('__session__')) {
    // store.dispatch('changeCurrPath', to.path)
    next();
  } else {
    router.push({ path: '/login' });
    next();
  }

}); */

//test
// store.commit('increment');


new Vue({
  render: h => h(App),
  router,
  store
}).$mount('#app');
